home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 209
/
209.d81
/
dec_hex converte
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
1KB
|
34 lines
5 poke53280,.:poke53281,.
10 print"[147] [154]decimal <--> hexidecimal"
20 print" (d[154])ecimal to hex"
30 print" (h[154])ex to decimal"
40 print" (q[154])uit"
50 geta$:ifa$=""then50
60 ifa$="d"then140
70 ifa$="h"then210
80 ifa$="q"then60000
90 goto50
100 rem * dec-hex & hex-dec converters
110 rem * created by louis f. sander
120 :
130 rem dec-hex converter (0-65535)
140 input "dec numeral (0-65535)";d
150 rem next line does the conversion
160 h$="":d=d/4096:forj=1to4:d%=d:h$=h$+chr$(48+d%-(d%>9)*7):d=16*(d-d%):next
170 print " hex numeral: [153]$";h$
175 print" [154]press space [154]to continue"
176 ifpeek(203)<>60then176
180 run
190 :
200 rem hex-dec converter (0000-ffff)
210 input " [154]4-digit hex numeral";h$
220 rem next line does the conversion
230 d=0:forj=1to4:d%=asc(h$):d%=d%-48+(d%>64)*7:h$=mid$(h$,2):d=16*d+d%:next
240 print " dec numeral: ";d
250 goto175
10000 d=peek(186):n$="dec/hex converte":open15,d,15,"s0:"+n$:close15:saven$,d:end
60000 d=peek(186):ifd<8thend=8
60001 print"[147][144]load"chr$(34)"b.tips and trick"chr$(34)","d
60010 print"run"
60020 poke631,13:poke632,13:poke198,2:end